# -*- coding:utf8 -*- #
# -----------------------------------------------------------------------------------
# ProjectName:  smart-water-iot-test
# FileName:     timeUtil.py
# Author  :     
# Datetime:     2022/8/29 13:40
# Description：
# -----------------------------------------------------------------------------------

import calendar
import time
from datetime import datetime


def get_now_time(timeType: int) -> str:
    """

    :param timeType:
                    1:年月日,时分秒
                    2：时刻
                    3：年月日
                    4：年月日，时
                    5:'%Y-%m'
                    6:yyyyMMddHHmmss
    :return: 时间
    """
    if timeType == 1:
        return datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    elif timeType == 2:
        return datetime.now().strftime('%H')
    elif timeType == 3:
        return datetime.now().strftime('%Y-%m-%d')
    elif timeType == 4:
        return datetime.now().strftime('%Y-%m-%d %H')
    elif timeType == 5:
        return datetime.now().strftime('%Y-%m')
    elif timeType == 6:
        return datetime.now().strftime('%Y%m%d%H%M%S')
    else:
        return datetime.now().strftime('%Y')


def get_timestamp():
    return str(calendar.timegm(time.gmtime())*1000)


if __name__ == '__main__':
    # print(get_now_time(2))
    # print(get_now_time(1))
    print(get_timestamp())
